# TODO int()
# 将其他数据类型转化为int
# 将字符串转为int
# 结论: 字符串转化整型,字符串里面必须是一个整数类型
"""
str1 = "123"
num1 = int(str1)
print(type(num1), num1)

str2 = "abc"
num2 = int(str2)    # 不能转换
str3 = "a12"
num3 = int(str3)    # 不能转换

# 将浮点数转化成int
str4 = 12.5
num4 = int(str4)
print(type(num4), num4)

# 将bool转化为int
bool1 = True    # 1
bool1 = False    # 0
"""

# TODO float()
# 其他数据类型转化为float
# 字符串转float
# 结论: 字符串转化float,字符串里面必须是一个数字类型(int, float)
"""
str1 = '10.5'
float1 = float(str1)
print(float1)

str2 = 'abc'
float2 = float(str2)    # 不能转换

str3 = '10'
float3 = float(str3)
print(float3)    # 结果为10.0

str4 = 10
float4 = float(str4)    
print(float4)    # 结果为10.0
"""


# TODO str()
# int -> str
int1 = 10
num1 = str(int1)
print(type(num1), num1)

# float -> str
float1 = 5.5
num2 = str(float1)
print(type(num2), num2)

# bool -> str
bool1 = True
num3 = str(bool1)
print(type(num3), num3)





